/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ivana
 */
@Entity
@Table(name = "remito")
@NamedQueries({
    @NamedQuery(name = "Remito.findAll", query = "SELECT r FROM Remito r"),
    @NamedQuery(name = "Remito.findByIdRemito", query = "SELECT r FROM Remito r WHERE r.idRemito = :idRemito"),
    @NamedQuery(name = "Remito.findByNumeroRemito", query = "SELECT r FROM Remito r WHERE r.numeroRemito = :numeroRemito"),
    @NamedQuery(name = "Remito.findByFechaHoraEgresoFinca", query = "SELECT r FROM Remito r WHERE r.fechaHoraEgresoFinca = :fechaHoraEgresoFinca")})
public class Remito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idRemito")
    private Integer idRemito;
    @Basic(optional = false)
    @Column(name = "numeroRemito")
    private String numeroRemito;
    @Basic(optional = false)
    @Column(name = "fechaHoraEgresoFinca")
    private String fechaHoraEgresoFinca;
    @OneToMany(mappedBy = "remito")
    private Collection<Detalleremito> detalleremitoCollection;
    @JoinColumn(name = "idProveedor", referencedColumnName = "idProveedor")
    @ManyToOne(optional = false)
    private Proveedor proveedor;
    @JoinColumn(name = "numeroContrato", referencedColumnName = "numeroContrato")
    @ManyToOne(optional = false)
    private Contrato contrato;
    @JoinColumn(name = "idTransporte", referencedColumnName = "idTransporte")
    @ManyToOne(optional = false)
    private Transporte transporte;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "remito")
    private Collection<Recepcion> recepcionCollection;

    public Remito() {
    }

    public Remito(Integer idRemito) {
        this.idRemito = idRemito;
    }

    public Remito(Integer idRemito, String numeroRemito, String fechaHoraEgresoFinca) {
        this.idRemito = idRemito;
        this.numeroRemito = numeroRemito;
        this.fechaHoraEgresoFinca = fechaHoraEgresoFinca;
    }

    public Integer getIdRemito() {
        return idRemito;
    }

    public void setIdRemito(Integer idRemito) {
        this.idRemito = idRemito;
    }

    public String getNumeroRemito() {
        return numeroRemito;
    }

    public void setNumeroRemito(String numeroRemito) {
        this.numeroRemito = numeroRemito;
    }

    public String getFechaHoraEgresoFinca() {
        return fechaHoraEgresoFinca;
    }

    public void setFechaHoraEgresoFinca(String fechaHoraEgresoFinca) {
        this.fechaHoraEgresoFinca = fechaHoraEgresoFinca;
    }

    public Collection<Detalleremito> getDetalleremitoCollection() {
        return detalleremitoCollection;
    }

    public void setDetalleremitoCollection(Collection<Detalleremito> detalleremitoCollection) {
        this.detalleremitoCollection = detalleremitoCollection;
    }

    public Proveedor getProveedor() {
        return proveedor;
    }

    public void setProveedor(Proveedor proveedor) {
        this.proveedor = proveedor;
    }

    public Contrato getContrato() {
        return contrato;
    }

    public void setContrato(Contrato contrato) {
        this.contrato = contrato;
    }

    public Transporte getTransporte() {
        return transporte;
    }

    public void setTransporte(Transporte transporte) {
        this.transporte = transporte;
    }

    public Collection<Recepcion> getRecepcionCollection() {
        return recepcionCollection;
    }

    public void setRecepcionCollection(Collection<Recepcion> recepcionCollection) {
        this.recepcionCollection = recepcionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRemito != null ? idRemito.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Remito)) {
            return false;
        }
        Remito other = (Remito) object;
        if ((this.idRemito == null && other.idRemito != null) || (this.idRemito != null && !this.idRemito.equals(other.idRemito))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Remito[idRemito=" + idRemito + "]";
    }

}
